﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using JigLibX.Collision;
using JigLibX.Physics;
using JigLibX.Geometry;
using JigLibX.Math;

namespace DARE
{
    public class CPhysicPlane : APhysicObject
    {

    #region fields

        private float m_size;

    #endregion

    #region properties

        public float Size { get { return m_size; } }

    #endregion

        #region ctor

        public CPhysicPlane()
        {
            Initialize(1);
        }

        public CPhysicPlane(float size)
        {
            Initialize(size);
        }

        private void Initialize(float size)
        {
            m_size = size;

            m_body = new Body();
            m_collisionSkin = new CollisionSkin(null);
            m_collisionSkin.AddPrimitive(new JigLibX.Geometry.Plane(), 
                new MaterialProperties(0.2f, 0.7f, 0.6f));
            PhysicsSystem.CurrentPhysicsSystem.CollisionSystem.AddCollisionSkin(m_collisionSkin);

            m_basicModel = new CPlaneModel("mPlane", size);
        }

        public override APhysicObject Clone()
        {
            CPhysicPlane clone = new CPhysicPlane(m_size);

            base.CopyPropertiesTo(clone);
            return clone;
        }

    #endregion

    }
}
